import request from "@/utils/request";
const Base = process.env.VUE_APP_BASE_API;
import qs from "qs";
//----------------IP段地址管理--------------//
// 获取ip地址业务列表
export function getIPAddressList(query) {
  return request({
    url: `${Base}/ipAddress/list`,
    method: "get",
    params: query,
  });
}

// 获取ip地址业务列表(不分页)
export function getSelectIPList(query) {
  return request({
    url: `${Base}/ipAddress/listNoPage`,
    method: "get",
    params: query,
  });
}

// 新增ip地址
export function addIPAddress(data) {
  return request({
    url: `${Base}/ipAddress/add`,
    method: "post",
    data: data,
  });
}

// 编辑ip地址
export function updateIPAddress(data) {
  return request({
    url: `${Base}/ipAddress/update`,
    method: "post",
    data: data,
  });
}

// 回收地址
export function recovery(id) {
  return request({
    url: `${Base}/ipAddress/recovery/${id}`,
    method: "get",
  });
}

// 地址启动/停用
export function operateIPStatus(data) {
  return request({
    url: `${Base}/ipAddress/startAndStopIp`,
    method: "post",
    data: data,
  });
}

// 分配单位
export function distributeUnit(data) {
  return request({
    url: `${Base}/ipAddress/distributeUnit`,
    method: "post",
    data: data,
  });
}

//IP删除
export function deleteIP(ids) {
  return request({
    url: `${Base}/ipAddress/remove/` + ids,
    method: "delete",
  });
}

//IP地址拆分网段
export function distributeIP(query) {
  return request({
    url: `${Base}/ipAddress/distributeIp`,
    method: "get",
    params: query,
  });
}

//IP地址新增拆分网段
export function addDistributeIP(data) {
  return request({
    url: `${Base}/ipAddress/redistributeIp`,
    method: "post",
    data: data,
  });
}
//----------------IP地址管理--------------//
//ip地址管理列表分页
export function getIPManagementList(query) {
  return request({
    url: `${Base}/ipInfo/page`,
    method: "get",
    params: query,
  });
}

//ip地址详情列表不分页
export function getIPDetailList(query) {
  return request({
    url: `${Base}/ipInfo/ipInfoList`,
    method: "get",
    params: query,
  });
}